{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 读取和处理数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/root/first_env/bin/python'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import sys\n",
    "\n",
    "sys.executable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['.ipynb_checkpoints',\n",
       " '1. Titanic数据预处理.ipynb',\n",
       " '未命名.ipynb',\n",
       " 'gender_submission.csv',\n",
       " 'train.csv',\n",
       " '.git',\n",
       " 'test.csv',\n",
       " 'README.md']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "os.listdir()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv(r'train.csv')\n",
    "test = pd.read_csv(r'test.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "\n",
       "                                                Name     Sex   Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male  22.0      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                             Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "4                           Allen, Mr. William Henry    male  35.0      0   \n",
       "\n",
       "   Parch            Ticket     Fare Cabin Embarked  \n",
       "0      0         A/5 21171   7.2500   NaN        S  \n",
       "1      0          PC 17599  71.2833   C85        C  \n",
       "2      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "3      0            113803  53.1000  C123        S  \n",
       "4      0            373450   8.0500   NaN        S  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 补全缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 891 entries, 0 to 890\n",
      "Data columns (total 12 columns):\n",
      " #   Column       Non-Null Count  Dtype  \n",
      "---  ------       --------------  -----  \n",
      " 0   PassengerId  891 non-null    int64  \n",
      " 1   Survived     891 non-null    int64  \n",
      " 2   Pclass       891 non-null    int64  \n",
      " 3   Name         891 non-null    object \n",
      " 4   Sex          891 non-null    object \n",
      " 5   Age          714 non-null    float64\n",
      " 6   SibSp        891 non-null    int64  \n",
      " 7   Parch        891 non-null    int64  \n",
      " 8   Ticket       891 non-null    object \n",
      " 9   Fare         891 non-null    float64\n",
      " 10  Cabin        204 non-null    object \n",
      " 11  Embarked     889 non-null    object \n",
      "dtypes: float64(2), int64(5), object(5)\n",
      "memory usage: 83.7+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PassengerId      0\n",
       "Survived         0\n",
       "Pclass           0\n",
       "Name             0\n",
       "Sex              0\n",
       "Age            177\n",
       "SibSp            0\n",
       "Parch            0\n",
       "Ticket           0\n",
       "Fare             0\n",
       "Cabin          687\n",
       "Embarked         2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Age'].fillna(data['Age'].median(), inplace=True)\n",
    "data['Embarked'].fillna(data['Embarked'].mode()[0], inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "PassengerId      0\n",
       "Survived         0\n",
       "Pclass           0\n",
       "Name             0\n",
       "Sex              0\n",
       "Age              0\n",
       "SibSp            0\n",
       "Parch            0\n",
       "Ticket           0\n",
       "Fare             0\n",
       "Cabin          687\n",
       "Embarked         0\n",
       "dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.isnull().sum()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['PassengerId', 'Survived', 'Pclass', 'Name', 'Sex', 'Age', 'SibSp',\n",
       "       'Parch', 'Ticket', 'Fare', 'Cabin', 'Embarked'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "drop_columns = ['PassengerId', 'Cabin', 'Ticket']\n",
    "data.drop(drop_columns, axis=1, inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Survived', 'Pclass', 'Name', 'Sex', 'Age', 'SibSp', 'Parch', 'Fare',\n",
       "       'Embarked'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass                                               Name  \\\n",
       "0         0       3                            Braund, Mr. Owen Harris   \n",
       "1         1       1  Cumings, Mrs. John Bradley (Florence Briggs Th...   \n",
       "2         1       3                             Heikkinen, Miss. Laina   \n",
       "3         1       1       Futrelle, Mrs. Jacques Heath (Lily May Peel)   \n",
       "4         0       3                           Allen, Mr. William Henry   \n",
       "\n",
       "      Sex   Age  SibSp  Parch     Fare Embarked  \n",
       "0    male  22.0      1      0   7.2500        S  \n",
       "1  female  38.0      1      0  71.2833        C  \n",
       "2  female  26.0      0      0   7.9250        S  \n",
       "3  female  35.0      1      0  53.1000        S  \n",
       "4    male  35.0      0      0   8.0500        S  "
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 创建新的特征"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Title'] = data['Name'].str.extract(', (\\w+).')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Family_size'] = data['SibSp'] + data['Parch'] + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "res = data['Family_size'] <= 1\n",
    "data['Isalone'] = res.apply(lambda x:1 if x else 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    537\n",
       "0    354\n",
       "Name: Isalone, dtype: int64"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Isalone'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      Mr\n",
       "1     Mrs\n",
       "2    Miss\n",
       "3     Mrs\n",
       "4      Mr\n",
       "Name: Title, dtype: object"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Title'].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "      <td>Miss</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass                                               Name  \\\n",
       "0         0       3                            Braund, Mr. Owen Harris   \n",
       "1         1       1  Cumings, Mrs. John Bradley (Florence Briggs Th...   \n",
       "2         1       3                             Heikkinen, Miss. Laina   \n",
       "3         1       1       Futrelle, Mrs. Jacques Heath (Lily May Peel)   \n",
       "4         0       3                           Allen, Mr. William Henry   \n",
       "\n",
       "      Sex   Age  SibSp  Parch     Fare Embarked Title  Family_size  Isalone  \n",
       "0    male  22.0      1      0   7.2500        S    Mr            2        0  \n",
       "1  female  38.0      1      0  71.2833        C   Mrs            2        0  \n",
       "2  female  26.0      0      0   7.9250        S  Miss            1        1  \n",
       "3  female  35.0      1      0  53.1000        S   Mrs            2        0  \n",
       "4    male  35.0      0      0   8.0500        S    Mr            1        1  "
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.drop(['Name'], inplace=True, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "      <td>Miss</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass     Sex   Age  SibSp  Parch     Fare Embarked Title  \\\n",
       "0         0       3    male  22.0      1      0   7.2500        S    Mr   \n",
       "1         1       1  female  38.0      1      0  71.2833        C   Mrs   \n",
       "2         1       3  female  26.0      0      0   7.9250        S  Miss   \n",
       "3         1       1  female  35.0      1      0  53.1000        S   Mrs   \n",
       "4         0       3    male  35.0      0      0   8.0500        S    Mr   \n",
       "\n",
       "   Family_size  Isalone  \n",
       "0            2        0  \n",
       "1            2        0  \n",
       "2            1        1  \n",
       "3            2        0  \n",
       "4            1        1  "
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Mr          517\n",
       "Miss        182\n",
       "Mrs         125\n",
       "Master       40\n",
       "Dr            7\n",
       "Rev           6\n",
       "Col           2\n",
       "Major         2\n",
       "Mlle          2\n",
       "Ms            1\n",
       "Lady          1\n",
       "Sir           1\n",
       "Mme           1\n",
       "the           1\n",
       "Don           1\n",
       "Capt          1\n",
       "Jonkheer      1\n",
       "Name: Title, dtype: int64"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Title'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Title'] = data['Title'].apply(lambda x:'Misc' if data['Title'].value_counts()[x] < 10 else x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Mr        517\n",
       "Miss      182\n",
       "Mrs       125\n",
       "Master     40\n",
       "Misc       27\n",
       "Name: Title, dtype: int64"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.Title.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "      <td>Miss</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass     Sex   Age  SibSp  Parch     Fare Embarked Title  \\\n",
       "0         0       3    male  22.0      1      0   7.2500        S    Mr   \n",
       "1         1       1  female  38.0      1      0  71.2833        C   Mrs   \n",
       "2         1       3  female  26.0      0      0   7.9250        S  Miss   \n",
       "3         1       1  female  35.0      1      0  53.1000        S   Mrs   \n",
       "4         0       3    male  35.0      0      0   8.0500        S    Mr   \n",
       "\n",
       "   Family_size  Isalone  \n",
       "0            2        0  \n",
       "1            2        0  \n",
       "2            1        1  \n",
       "3            2        0  \n",
       "4            1        1  "
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import LabelEncoder\n",
    "\n",
    "coder = LabelEncoder()\n",
    "\n",
    "data['Sex'] = coder.fit_transform(data['Sex'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Sex'] = data['Sex'].astype('category')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CategoricalDtype(categories=[0, 1], ordered=False)"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Sex'].dtype"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Pclass'] = coder.fit_transform(data['Pclass'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2    491\n",
       "0    216\n",
       "1    184\n",
       "Name: Pclass, dtype: int64"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Pclass'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "      <td>Miss</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch     Fare Embarked Title  \\\n",
       "0         0       2   1  22.0      1      0   7.2500        S    Mr   \n",
       "1         1       0   0  38.0      1      0  71.2833        C   Mrs   \n",
       "2         1       2   0  26.0      0      0   7.9250        S  Miss   \n",
       "3         1       0   0  35.0      1      0  53.1000        S   Mrs   \n",
       "4         0       2   1  35.0      0      0   8.0500        S    Mr   \n",
       "\n",
       "   Family_size  Isalone  \n",
       "0            2        0  \n",
       "1            2        0  \n",
       "2            1        1  \n",
       "3            2        0  \n",
       "4            1        1  "
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Title</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Master</th>\n",
       "      <td>0.575000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Misc</th>\n",
       "      <td>0.444444</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Miss</th>\n",
       "      <td>0.697802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Mr</th>\n",
       "      <td>0.156673</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Mrs</th>\n",
       "      <td>0.792000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        Survived\n",
       "Title           \n",
       "Master  0.575000\n",
       "Misc    0.444444\n",
       "Miss    0.697802\n",
       "Mr      0.156673\n",
       "Mrs     0.792000"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[['Survived', 'Title']].groupby(['Title']).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>S</td>\n",
       "      <td>Miss</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>S</td>\n",
       "      <td>Mrs</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>S</td>\n",
       "      <td>Mr</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch     Fare Embarked Title  \\\n",
       "0         0       2   1  22.0      1      0   7.2500        S    Mr   \n",
       "1         1       0   0  38.0      1      0  71.2833        C   Mrs   \n",
       "2         1       2   0  26.0      0      0   7.9250        S  Miss   \n",
       "3         1       0   0  35.0      1      0  53.1000        S   Mrs   \n",
       "4         0       2   1  35.0      0      0   8.0500        S    Mr   \n",
       "\n",
       "   Family_size  Isalone  \n",
       "0            2        0  \n",
       "1            2        0  \n",
       "2            1        1  \n",
       "3            2        0  \n",
       "4            1        1  "
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [],
   "source": [
    "encoder = ['Embarked', 'Title']\n",
    "\n",
    "for each in encoder:\n",
    "    data[each] = coder.fit_transform(data[each])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch     Fare  Embarked  Title  \\\n",
       "0         0       2   1  22.0      1      0   7.2500         2      3   \n",
       "1         1       0   0  38.0      1      0  71.2833         0      4   \n",
       "2         1       2   0  26.0      0      0   7.9250         2      2   \n",
       "3         1       0   0  35.0      1      0  53.1000         2      4   \n",
       "4         0       2   1  35.0      0      0   8.0500         2      3   \n",
       "\n",
       "   Family_size  Isalone  \n",
       "0            2        0  \n",
       "1            2        0  \n",
       "2            1        1  \n",
       "3            2        0  \n",
       "4            1        1  "
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['FareBand'] = pd.qcut(data['Fare'], 4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>FareBand</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>(-0.001, 7.91]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>(31.0, 512.329]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>(7.91, 14.454]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>(31.0, 512.329]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>(7.91, 14.454]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch     Fare  Embarked  Title  \\\n",
       "0         0       2   1  22.0      1      0   7.2500         2      3   \n",
       "1         1       0   0  38.0      1      0  71.2833         0      4   \n",
       "2         1       2   0  26.0      0      0   7.9250         2      2   \n",
       "3         1       0   0  35.0      1      0  53.1000         2      4   \n",
       "4         0       2   1  35.0      0      0   8.0500         2      3   \n",
       "\n",
       "   Family_size  Isalone         FareBand  \n",
       "0            2        0   (-0.001, 7.91]  \n",
       "1            2        0  (31.0, 512.329]  \n",
       "2            1        1   (7.91, 14.454]  \n",
       "3            2        0  (31.0, 512.329]  \n",
       "4            1        1   (7.91, 14.454]  "
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(7.91, 14.454]     224\n",
       "(-0.001, 7.91]     223\n",
       "(31.0, 512.329]    222\n",
       "(14.454, 31.0]     222\n",
       "Name: FareBand, dtype: int64"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['FareBand'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FareBand</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>(-0.001, 7.91]</th>\n",
       "      <td>0.197309</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(7.91, 14.454]</th>\n",
       "      <td>0.303571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(14.454, 31.0]</th>\n",
       "      <td>0.454955</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>(31.0, 512.329]</th>\n",
       "      <td>0.581081</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Survived\n",
       "FareBand                 \n",
       "(-0.001, 7.91]   0.197309\n",
       "(7.91, 14.454]   0.303571\n",
       "(14.454, 31.0]   0.454955\n",
       "(31.0, 512.329]  0.581081"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data[['FareBand', 'Survived']].groupby('FareBand').mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CategoricalDtype(categories=[(-0.001, 7.91], (7.91, 14.454], (14.454, 31.0], (31.0, 512.329]],\n",
       "              ordered=True)"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['FareBand'].dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['FareBand'] = coder.fit_transform(data['FareBand'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>FareBand</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch     Fare  Embarked  Title  \\\n",
       "0         0       2   1  22.0      1      0   7.2500         2      3   \n",
       "1         1       0   0  38.0      1      0  71.2833         0      4   \n",
       "2         1       2   0  26.0      0      0   7.9250         2      2   \n",
       "3         1       0   0  35.0      1      0  53.1000         2      4   \n",
       "4         0       2   1  35.0      0      0   8.0500         2      3   \n",
       "\n",
       "   Family_size  Isalone  FareBand  \n",
       "0            2        0         0  \n",
       "1            2        0         3  \n",
       "2            1        1         1  \n",
       "3            2        0         3  \n",
       "4            1        1         1  "
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.drop('Fare', inplace=True, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Survived_0</th>\n",
       "      <th>Survived_1</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Survived_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0           1   \n",
       "1   0  38.0      1      0         0      4            2        0           0   \n",
       "2   0  26.0      0      0         2      2            1        1           0   \n",
       "3   0  35.0      1      0         2      4            2        0           0   \n",
       "4   1  35.0      0      0         2      3            1        1           1   \n",
       "\n",
       "   Survived_1  Pclass_0  Pclass_1  Pclass_2  FareBand_0  FareBand_1  \\\n",
       "0           0         0         0         1           1           0   \n",
       "1           1         1         0         0           0           0   \n",
       "2           1         0         0         1           0           1   \n",
       "3           1         1         0         0           0           0   \n",
       "4           0         0         0         1           0           1   \n",
       "\n",
       "   FareBand_2  FareBand_3  \n",
       "0           0           0  \n",
       "1           0           1  \n",
       "2           0           0  \n",
       "3           0           1  \n",
       "4           0           0  "
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 108,
   "metadata": {},
   "outputs": [],
   "source": [
    "X, Y = data.loc[:,data.columns != 'Survived'], data.loc[:,'Survived']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>FareBand</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Pclass Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  \\\n",
       "0       2   1  22.0      1      0         2      3            2        0   \n",
       "1       0   0  38.0      1      0         0      4            2        0   \n",
       "2       2   0  26.0      0      0         2      2            1        1   \n",
       "3       0   0  35.0      1      0         2      4            2        0   \n",
       "4       2   1  35.0      0      0         2      3            1        1   \n",
       "\n",
       "   FareBand  \n",
       "0         0  \n",
       "1         3  \n",
       "2         1  \n",
       "3         3  \n",
       "4         1  "
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 算法建模"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 171,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "X_train, X_test, Y_train, Y_test = train_test_split(X, Y, train_size=0.7, random_state=2020)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(623, 10)"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(268, 10)"
      ]
     },
     "execution_count": 112,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_test.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(623,)"
      ]
     },
     "execution_count": 113,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/first_env/lib64/python3.6/site-packages/sklearn/linear_model/_logistic.py:764: ConvergenceWarning: lbfgs failed to converge (status=1):\n",
      "STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n",
      "\n",
      "Increase the number of iterations (max_iter) or scale the data as shown in:\n",
      "    https://scikit-learn.org/stable/modules/preprocessing.html\n",
      "Please also refer to the documentation for alternative solver options:\n",
      "    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n",
      "  extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.7910447761194029"
      ]
     },
     "execution_count": 114,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "lg = LogisticRegression()\n",
    "\n",
    "lg.fit(X_train, Y_train)\n",
    "# lg.preadict(X_test)\n",
    "lg.score(X_test, Y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6268656716417911"
      ]
     },
     "execution_count": 173,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.svm import SVC\n",
    "\n",
    "sv = SVC()\n",
    "sv.fit(X_train, Y_train)\n",
    "sv.score(X_test, Y_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "这样的编码方式是有问题的，使用独热编码再试试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>FareBand</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Survived  Pclass Sex   Age  SibSp  Parch  Embarked  Title  Family_size  \\\n",
       "0         0       2   1  22.0      1      0         2      3            2   \n",
       "1         1       0   0  38.0      1      0         0      4            2   \n",
       "2         1       2   0  26.0      0      0         2      2            1   \n",
       "3         1       0   0  35.0      1      0         2      4            2   \n",
       "4         0       2   1  35.0      0      0         2      3            1   \n",
       "\n",
       "   Isalone  FareBand  \n",
       "0        0         0  \n",
       "1        0         3  \n",
       "2        1         1  \n",
       "3        0         3  \n",
       "4        1         1  "
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.get_dummies(data, columns=['Pclass', 'FareBand'], prefix=['Pclass', 'FareBand'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Survived_0</th>\n",
       "      <th>Survived_1</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Survived_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0           1   \n",
       "1   0  38.0      1      0         0      4            2        0           0   \n",
       "2   0  26.0      0      0         2      2            1        1           0   \n",
       "3   0  35.0      1      0         2      4            2        0           0   \n",
       "4   1  35.0      0      0         2      3            1        1           1   \n",
       "\n",
       "   Survived_1  Pclass_0  Pclass_1  Pclass_2  FareBand_0  FareBand_1  \\\n",
       "0           0         0         0         1           1           0   \n",
       "1           1         1         0         0           0           0   \n",
       "2           1         0         0         1           0           1   \n",
       "3           1         1         0         0           0           0   \n",
       "4           0         0         0         1           0           1   \n",
       "\n",
       "   FareBand_2  FareBand_3  \n",
       "0           0           0  \n",
       "1           0           1  \n",
       "2           0           0  \n",
       "3           0           1  \n",
       "4           0           0  "
      ]
     },
     "execution_count": 124,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 134,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.drop(columns=['Survived_1'], inplace=True, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 132,
   "metadata": {},
   "outputs": [],
   "source": [
    "# help(data.rename)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 131,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.rename({'Survived_1':'Survived'}, inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 135,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Pclass_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0         0   \n",
       "1   0  38.0      1      0         0      4            2        0         1   \n",
       "2   0  26.0      0      0         2      2            1        1         0   \n",
       "3   0  35.0      1      0         2      4            2        0         1   \n",
       "4   1  35.0      0      0         2      3            1        1         0   \n",
       "\n",
       "   Pclass_1  Pclass_2  FareBand_0  FareBand_1  FareBand_2  FareBand_3  \n",
       "0         0         1           1           0           0           0  \n",
       "1         0         0           0           0           0           1  \n",
       "2         0         1           0           1           0           0  \n",
       "3         0         0           0           0           0           1  \n",
       "4         0         1           0           1           0           0  "
      ]
     },
     "execution_count": 135,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 136,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['Survived'] = Y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 137,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "      <th>Survived</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Pclass_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0         0   \n",
       "1   0  38.0      1      0         0      4            2        0         1   \n",
       "2   0  26.0      0      0         2      2            1        1         0   \n",
       "3   0  35.0      1      0         2      4            2        0         1   \n",
       "4   1  35.0      0      0         2      3            1        1         0   \n",
       "\n",
       "   Pclass_1  Pclass_2  FareBand_0  FareBand_1  FareBand_2  FareBand_3  \\\n",
       "0         0         1           1           0           0           0   \n",
       "1         0         0           0           0           0           1   \n",
       "2         0         1           0           1           0           0   \n",
       "3         0         0           0           0           0           1   \n",
       "4         0         1           0           1           0           0   \n",
       "\n",
       "   Survived  \n",
       "0         0  \n",
       "1         1  \n",
       "2         1  \n",
       "3         1  \n",
       "4         0  "
      ]
     },
     "execution_count": 137,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 166,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import train_test_split\n",
    "\n",
    "x1, x2, y1, y2 = train_test_split(data.drop(['Survived'] ,axis=1), data['Survived'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 161,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/first_env/lib64/python3.6/site-packages/sklearn/linear_model/_logistic.py:764: ConvergenceWarning: lbfgs failed to converge (status=1):\n",
      "STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n",
      "\n",
      "Increase the number of iterations (max_iter) or scale the data as shown in:\n",
      "    https://scikit-learn.org/stable/modules/preprocessing.html\n",
      "Please also refer to the documentation for alternative solver options:\n",
      "    https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n",
      "  extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.8026905829596412"
      ]
     },
     "execution_count": 161,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "lg = LogisticRegression()\n",
    "lg.fit(x1, y1)\n",
    "lg.score(x2,y2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以发现经过编码后的准确率确实上升了"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 164,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.svm import SVC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 167,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "      <th>Survived</th>\n",
       "      <th>new_age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Pclass_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0         0   \n",
       "1   0  38.0      1      0         0      4            2        0         1   \n",
       "2   0  26.0      0      0         2      2            1        1         0   \n",
       "3   0  35.0      1      0         2      4            2        0         1   \n",
       "4   1  35.0      0      0         2      3            1        1         0   \n",
       "\n",
       "   Pclass_1  Pclass_2  FareBand_0  FareBand_1  FareBand_2  FareBand_3  \\\n",
       "0         0         1           1           0           0           0   \n",
       "1         0         0           0           0           0           1   \n",
       "2         0         1           0           1           0           0   \n",
       "3         0         0           0           0           0           1   \n",
       "4         0         1           0           1           0           0   \n",
       "\n",
       "   Survived  new_age  \n",
       "0         0        1  \n",
       "1         1        2  \n",
       "2         1        1  \n",
       "3         1        2  \n",
       "4         0        2  "
      ]
     },
     "execution_count": 167,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6143497757847534"
      ]
     },
     "execution_count": 169,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "svc_ = SVC()\n",
    "svc_.fit(x1, y1)\n",
    "svc_.score(x2,y2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 155,
   "metadata": {},
   "outputs": [],
   "source": [
    "new_data = pd.get_dummies(data, columns=['new_age'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [],
   "source": [
    "data['new_age']=pd.cut(data['Age'], 5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Embarked</th>\n",
       "      <th>Title</th>\n",
       "      <th>Family_size</th>\n",
       "      <th>Isalone</th>\n",
       "      <th>Pclass_0</th>\n",
       "      <th>Pclass_1</th>\n",
       "      <th>Pclass_2</th>\n",
       "      <th>FareBand_0</th>\n",
       "      <th>FareBand_1</th>\n",
       "      <th>FareBand_2</th>\n",
       "      <th>FareBand_3</th>\n",
       "      <th>Survived</th>\n",
       "      <th>new_age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>(16.336, 32.252]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>(32.252, 48.168]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>(16.336, 32.252]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>(32.252, 48.168]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>(32.252, 48.168]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Sex   Age  SibSp  Parch  Embarked  Title  Family_size  Isalone  Pclass_0  \\\n",
       "0   1  22.0      1      0         2      3            2        0         0   \n",
       "1   0  38.0      1      0         0      4            2        0         1   \n",
       "2   0  26.0      0      0         2      2            1        1         0   \n",
       "3   0  35.0      1      0         2      4            2        0         1   \n",
       "4   1  35.0      0      0         2      3            1        1         0   \n",
       "\n",
       "   Pclass_1  Pclass_2  FareBand_0  FareBand_1  FareBand_2  FareBand_3  \\\n",
       "0         0         1           1           0           0           0   \n",
       "1         0         0           0           0           0           1   \n",
       "2         0         1           0           1           0           0   \n",
       "3         0         0           0           0           0           1   \n",
       "4         0         1           0           1           0           0   \n",
       "\n",
       "   Survived           new_age  \n",
       "0         0  (16.336, 32.252]  \n",
       "1         1  (32.252, 48.168]  \n",
       "2         1  (16.336, 32.252]  \n",
       "3         1  (32.252, 48.168]  \n",
       "4         0  (32.252, 48.168]  "
      ]
     },
     "execution_count": 150,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.8340807174887892"
      ]
     },
     "execution_count": 175,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn import tree\n",
    "\n",
    "tr = tree.DecisionTreeClassifier()\n",
    "\n",
    "tr.fit(x1, y1)\n",
    "tr.score(x2, y2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on DecisionTreeClassifier in module sklearn.tree._classes object:\n",
      "\n",
      "class DecisionTreeClassifier(sklearn.base.ClassifierMixin, BaseDecisionTree)\n",
      " |  A decision tree classifier.\n",
      " |  \n",
      " |  Read more in the :ref:`User Guide <tree>`.\n",
      " |  \n",
      " |  Parameters\n",
      " |  ----------\n",
      " |  criterion : {\"gini\", \"entropy\"}, default=\"gini\"\n",
      " |      The function to measure the quality of a split. Supported criteria are\n",
      " |      \"gini\" for the Gini impurity and \"entropy\" for the information gain.\n",
      " |  \n",
      " |  splitter : {\"best\", \"random\"}, default=\"best\"\n",
      " |      The strategy used to choose the split at each node. Supported\n",
      " |      strategies are \"best\" to choose the best split and \"random\" to choose\n",
      " |      the best random split.\n",
      " |  \n",
      " |  max_depth : int, default=None\n",
      " |      The maximum depth of the tree. If None, then nodes are expanded until\n",
      " |      all leaves are pure or until all leaves contain less than\n",
      " |      min_samples_split samples.\n",
      " |  \n",
      " |  min_samples_split : int or float, default=2\n",
      " |      The minimum number of samples required to split an internal node:\n",
      " |  \n",
      " |      - If int, then consider `min_samples_split` as the minimum number.\n",
      " |      - If float, then `min_samples_split` is a fraction and\n",
      " |        `ceil(min_samples_split * n_samples)` are the minimum\n",
      " |        number of samples for each split.\n",
      " |  \n",
      " |      .. versionchanged:: 0.18\n",
      " |         Added float values for fractions.\n",
      " |  \n",
      " |  min_samples_leaf : int or float, default=1\n",
      " |      The minimum number of samples required to be at a leaf node.\n",
      " |      A split point at any depth will only be considered if it leaves at\n",
      " |      least ``min_samples_leaf`` training samples in each of the left and\n",
      " |      right branches.  This may have the effect of smoothing the model,\n",
      " |      especially in regression.\n",
      " |  \n",
      " |      - If int, then consider `min_samples_leaf` as the minimum number.\n",
      " |      - If float, then `min_samples_leaf` is a fraction and\n",
      " |        `ceil(min_samples_leaf * n_samples)` are the minimum\n",
      " |        number of samples for each node.\n",
      " |  \n",
      " |      .. versionchanged:: 0.18\n",
      " |         Added float values for fractions.\n",
      " |  \n",
      " |  min_weight_fraction_leaf : float, default=0.0\n",
      " |      The minimum weighted fraction of the sum total of weights (of all\n",
      " |      the input samples) required to be at a leaf node. Samples have\n",
      " |      equal weight when sample_weight is not provided.\n",
      " |  \n",
      " |  max_features : int, float or {\"auto\", \"sqrt\", \"log2\"}, default=None\n",
      " |      The number of features to consider when looking for the best split:\n",
      " |  \n",
      " |          - If int, then consider `max_features` features at each split.\n",
      " |          - If float, then `max_features` is a fraction and\n",
      " |            `int(max_features * n_features)` features are considered at each\n",
      " |            split.\n",
      " |          - If \"auto\", then `max_features=sqrt(n_features)`.\n",
      " |          - If \"sqrt\", then `max_features=sqrt(n_features)`.\n",
      " |          - If \"log2\", then `max_features=log2(n_features)`.\n",
      " |          - If None, then `max_features=n_features`.\n",
      " |  \n",
      " |      Note: the search for a split does not stop until at least one\n",
      " |      valid partition of the node samples is found, even if it requires to\n",
      " |      effectively inspect more than ``max_features`` features.\n",
      " |  \n",
      " |  random_state : int, RandomState instance, default=None\n",
      " |      Controls the randomness of the estimator. The features are always\n",
      " |      randomly permuted at each split, even if ``splitter`` is set to\n",
      " |      ``\"best\"``. When ``max_features < n_features``, the algorithm will\n",
      " |      select ``max_features`` at random at each split before finding the best\n",
      " |      split among them. But the best found split may vary across different\n",
      " |      runs, even if ``max_features=n_features``. That is the case, if the\n",
      " |      improvement of the criterion is identical for several splits and one\n",
      " |      split has to be selected at random. To obtain a deterministic behaviour\n",
      " |      during fitting, ``random_state`` has to be fixed to an integer.\n",
      " |      See :term:`Glossary <random_state>` for details.\n",
      " |  \n",
      " |  max_leaf_nodes : int, default=None\n",
      " |      Grow a tree with ``max_leaf_nodes`` in best-first fashion.\n",
      " |      Best nodes are defined as relative reduction in impurity.\n",
      " |      If None then unlimited number of leaf nodes.\n",
      " |  \n",
      " |  min_impurity_decrease : float, default=0.0\n",
      " |      A node will be split if this split induces a decrease of the impurity\n",
      " |      greater than or equal to this value.\n",
      " |  \n",
      " |      The weighted impurity decrease equation is the following::\n",
      " |  \n",
      " |          N_t / N * (impurity - N_t_R / N_t * right_impurity\n",
      " |                              - N_t_L / N_t * left_impurity)\n",
      " |  \n",
      " |      where ``N`` is the total number of samples, ``N_t`` is the number of\n",
      " |      samples at the current node, ``N_t_L`` is the number of samples in the\n",
      " |      left child, and ``N_t_R`` is the number of samples in the right child.\n",
      " |  \n",
      " |      ``N``, ``N_t``, ``N_t_R`` and ``N_t_L`` all refer to the weighted sum,\n",
      " |      if ``sample_weight`` is passed.\n",
      " |  \n",
      " |      .. versionadded:: 0.19\n",
      " |  \n",
      " |  min_impurity_split : float, default=0\n",
      " |      Threshold for early stopping in tree growth. A node will split\n",
      " |      if its impurity is above the threshold, otherwise it is a leaf.\n",
      " |  \n",
      " |      .. deprecated:: 0.19\n",
      " |         ``min_impurity_split`` has been deprecated in favor of\n",
      " |         ``min_impurity_decrease`` in 0.19. The default value of\n",
      " |         ``min_impurity_split`` has changed from 1e-7 to 0 in 0.23 and it\n",
      " |         will be removed in 0.25. Use ``min_impurity_decrease`` instead.\n",
      " |  \n",
      " |  class_weight : dict, list of dict or \"balanced\", default=None\n",
      " |      Weights associated with classes in the form ``{class_label: weight}``.\n",
      " |      If None, all classes are supposed to have weight one. For\n",
      " |      multi-output problems, a list of dicts can be provided in the same\n",
      " |      order as the columns of y.\n",
      " |  \n",
      " |      Note that for multioutput (including multilabel) weights should be\n",
      " |      defined for each class of every column in its own dict. For example,\n",
      " |      for four-class multilabel classification weights should be\n",
      " |      [{0: 1, 1: 1}, {0: 1, 1: 5}, {0: 1, 1: 1}, {0: 1, 1: 1}] instead of\n",
      " |      [{1:1}, {2:5}, {3:1}, {4:1}].\n",
      " |  \n",
      " |      The \"balanced\" mode uses the values of y to automatically adjust\n",
      " |      weights inversely proportional to class frequencies in the input data\n",
      " |      as ``n_samples / (n_classes * np.bincount(y))``\n",
      " |  \n",
      " |      For multi-output, the weights of each column of y will be multiplied.\n",
      " |  \n",
      " |      Note that these weights will be multiplied with sample_weight (passed\n",
      " |      through the fit method) if sample_weight is specified.\n",
      " |  \n",
      " |  presort : deprecated, default='deprecated'\n",
      " |      This parameter is deprecated and will be removed in v0.24.\n",
      " |  \n",
      " |      .. deprecated:: 0.22\n",
      " |  \n",
      " |  ccp_alpha : non-negative float, default=0.0\n",
      " |      Complexity parameter used for Minimal Cost-Complexity Pruning. The\n",
      " |      subtree with the largest cost complexity that is smaller than\n",
      " |      ``ccp_alpha`` will be chosen. By default, no pruning is performed. See\n",
      " |      :ref:`minimal_cost_complexity_pruning` for details.\n",
      " |  \n",
      " |      .. versionadded:: 0.22\n",
      " |  \n",
      " |  Attributes\n",
      " |  ----------\n",
      " |  classes_ : ndarray of shape (n_classes,) or list of ndarray\n",
      " |      The classes labels (single output problem),\n",
      " |      or a list of arrays of class labels (multi-output problem).\n",
      " |  \n",
      " |  feature_importances_ : ndarray of shape (n_features,)\n",
      " |      The impurity-based feature importances.\n",
      " |      The higher, the more important the feature.\n",
      " |      The importance of a feature is computed as the (normalized)\n",
      " |      total reduction of the criterion brought by that feature.  It is also\n",
      " |      known as the Gini importance [4]_.\n",
      " |  \n",
      " |      Warning: impurity-based feature importances can be misleading for\n",
      " |      high cardinality features (many unique values). See\n",
      " |      :func:`sklearn.inspection.permutation_importance` as an alternative.\n",
      " |  \n",
      " |  max_features_ : int\n",
      " |      The inferred value of max_features.\n",
      " |  \n",
      " |  n_classes_ : int or list of int\n",
      " |      The number of classes (for single output problems),\n",
      " |      or a list containing the number of classes for each\n",
      " |      output (for multi-output problems).\n",
      " |  \n",
      " |  n_features_ : int\n",
      " |      The number of features when ``fit`` is performed.\n",
      " |  \n",
      " |  n_outputs_ : int\n",
      " |      The number of outputs when ``fit`` is performed.\n",
      " |  \n",
      " |  tree_ : Tree\n",
      " |      The underlying Tree object. Please refer to\n",
      " |      ``help(sklearn.tree._tree.Tree)`` for attributes of Tree object and\n",
      " |      :ref:`sphx_glr_auto_examples_tree_plot_unveil_tree_structure.py`\n",
      " |      for basic usage of these attributes.\n",
      " |  \n",
      " |  See Also\n",
      " |  --------\n",
      " |  DecisionTreeRegressor : A decision tree regressor.\n",
      " |  \n",
      " |  Notes\n",
      " |  -----\n",
      " |  The default values for the parameters controlling the size of the trees\n",
      " |  (e.g. ``max_depth``, ``min_samples_leaf``, etc.) lead to fully grown and\n",
      " |  unpruned trees which can potentially be very large on some data sets. To\n",
      " |  reduce memory consumption, the complexity and size of the trees should be\n",
      " |  controlled by setting those parameter values.\n",
      " |  \n",
      " |  References\n",
      " |  ----------\n",
      " |  \n",
      " |  .. [1] https://en.wikipedia.org/wiki/Decision_tree_learning\n",
      " |  \n",
      " |  .. [2] L. Breiman, J. Friedman, R. Olshen, and C. Stone, \"Classification\n",
      " |         and Regression Trees\", Wadsworth, Belmont, CA, 1984.\n",
      " |  \n",
      " |  .. [3] T. Hastie, R. Tibshirani and J. Friedman. \"Elements of Statistical\n",
      " |         Learning\", Springer, 2009.\n",
      " |  \n",
      " |  .. [4] L. Breiman, and A. Cutler, \"Random Forests\",\n",
      " |         https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm\n",
      " |  \n",
      " |  Examples\n",
      " |  --------\n",
      " |  >>> from sklearn.datasets import load_iris\n",
      " |  >>> from sklearn.model_selection import cross_val_score\n",
      " |  >>> from sklearn.tree import DecisionTreeClassifier\n",
      " |  >>> clf = DecisionTreeClassifier(random_state=0)\n",
      " |  >>> iris = load_iris()\n",
      " |  >>> cross_val_score(clf, iris.data, iris.target, cv=10)\n",
      " |  ...                             # doctest: +SKIP\n",
      " |  ...\n",
      " |  array([ 1.     ,  0.93...,  0.86...,  0.93...,  0.93...,\n",
      " |          0.93...,  0.93...,  1.     ,  0.93...,  1.      ])\n",
      " |  \n",
      " |  Method resolution order:\n",
      " |      DecisionTreeClassifier\n",
      " |      sklearn.base.ClassifierMixin\n",
      " |      BaseDecisionTree\n",
      " |      sklearn.base.MultiOutputMixin\n",
      " |      sklearn.base.BaseEstimator\n",
      " |      builtins.object\n",
      " |  \n",
      " |  Methods defined here:\n",
      " |  \n",
      " |  __init__(self, *, criterion='gini', splitter='best', max_depth=None, min_samples_split=2, min_samples_leaf=1, min_weight_fraction_leaf=0.0, max_features=None, random_state=None, max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, class_weight=None, presort='deprecated', ccp_alpha=0.0)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |  \n",
      " |  fit(self, X, y, sample_weight=None, check_input=True, X_idx_sorted=None)\n",
      " |      Build a decision tree classifier from the training set (X, y).\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The training input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csc_matrix``.\n",
      " |      \n",
      " |      y : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
      " |          The target values (class labels) as integers or strings.\n",
      " |      \n",
      " |      sample_weight : array-like of shape (n_samples,), default=None\n",
      " |          Sample weights. If None, then samples are equally weighted. Splits\n",
      " |          that would create child nodes with net zero or negative weight are\n",
      " |          ignored while searching for a split in each node. Splits are also\n",
      " |          ignored if they would result in any single class carrying a\n",
      " |          negative weight in either child node.\n",
      " |      \n",
      " |      check_input : bool, default=True\n",
      " |          Allow to bypass several input checking.\n",
      " |          Don't use this parameter unless you know what you do.\n",
      " |      \n",
      " |      X_idx_sorted : array-like of shape (n_samples, n_features),                 default=None\n",
      " |          The indexes of the sorted training input samples. If many tree\n",
      " |          are grown on the same dataset, this allows the ordering to be\n",
      " |          cached between trees. If None, the data will be sorted here.\n",
      " |          Don't use this parameter unless you know what to do.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      self : DecisionTreeClassifier\n",
      " |          Fitted estimator.\n",
      " |  \n",
      " |  predict_log_proba(self, X)\n",
      " |      Predict class log-probabilities of the input samples X.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csr_matrix``.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      proba : ndarray of shape (n_samples, n_classes) or list of n_outputs             such arrays if n_outputs > 1\n",
      " |          The class log-probabilities of the input samples. The order of the\n",
      " |          classes corresponds to that in the attribute :term:`classes_`.\n",
      " |  \n",
      " |  predict_proba(self, X, check_input=True)\n",
      " |      Predict class probabilities of the input samples X.\n",
      " |      \n",
      " |      The predicted class probability is the fraction of samples of the same\n",
      " |      class in a leaf.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csr_matrix``.\n",
      " |      \n",
      " |      check_input : bool, default=True\n",
      " |          Allow to bypass several input checking.\n",
      " |          Don't use this parameter unless you know what you do.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      proba : ndarray of shape (n_samples, n_classes) or list of n_outputs             such arrays if n_outputs > 1\n",
      " |          The class probabilities of the input samples. The order of the\n",
      " |          classes corresponds to that in the attribute :term:`classes_`.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |  \n",
      " |  __abstractmethods__ = frozenset()\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sklearn.base.ClassifierMixin:\n",
      " |  \n",
      " |  score(self, X, y, sample_weight=None)\n",
      " |      Return the mean accuracy on the given test data and labels.\n",
      " |      \n",
      " |      In multi-label classification, this is the subset accuracy\n",
      " |      which is a harsh metric since you require for each sample that\n",
      " |      each label set be correctly predicted.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : array-like of shape (n_samples, n_features)\n",
      " |          Test samples.\n",
      " |      \n",
      " |      y : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
      " |          True labels for X.\n",
      " |      \n",
      " |      sample_weight : array-like of shape (n_samples,), default=None\n",
      " |          Sample weights.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      score : float\n",
      " |          Mean accuracy of self.predict(X) wrt. y.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from sklearn.base.ClassifierMixin:\n",
      " |  \n",
      " |  __dict__\n",
      " |      dictionary for instance variables (if defined)\n",
      " |  \n",
      " |  __weakref__\n",
      " |      list of weak references to the object (if defined)\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from BaseDecisionTree:\n",
      " |  \n",
      " |  apply(self, X, check_input=True)\n",
      " |      Return the index of the leaf that each sample is predicted as.\n",
      " |      \n",
      " |      .. versionadded:: 0.17\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csr_matrix``.\n",
      " |      \n",
      " |      check_input : bool, default=True\n",
      " |          Allow to bypass several input checking.\n",
      " |          Don't use this parameter unless you know what you do.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      X_leaves : array-like of shape (n_samples,)\n",
      " |          For each datapoint x in X, return the index of the leaf x\n",
      " |          ends up in. Leaves are numbered within\n",
      " |          ``[0; self.tree_.node_count)``, possibly with gaps in the\n",
      " |          numbering.\n",
      " |  \n",
      " |  cost_complexity_pruning_path(self, X, y, sample_weight=None)\n",
      " |      Compute the pruning path during Minimal Cost-Complexity Pruning.\n",
      " |      \n",
      " |      See :ref:`minimal_cost_complexity_pruning` for details on the pruning\n",
      " |      process.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The training input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csc_matrix``.\n",
      " |      \n",
      " |      y : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
      " |          The target values (class labels) as integers or strings.\n",
      " |      \n",
      " |      sample_weight : array-like of shape (n_samples,), default=None\n",
      " |          Sample weights. If None, then samples are equally weighted. Splits\n",
      " |          that would create child nodes with net zero or negative weight are\n",
      " |          ignored while searching for a split in each node. Splits are also\n",
      " |          ignored if they would result in any single class carrying a\n",
      " |          negative weight in either child node.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      ccp_path : :class:`~sklearn.utils.Bunch`\n",
      " |          Dictionary-like object, with the following attributes.\n",
      " |      \n",
      " |          ccp_alphas : ndarray\n",
      " |              Effective alphas of subtree during pruning.\n",
      " |      \n",
      " |          impurities : ndarray\n",
      " |              Sum of the impurities of the subtree leaves for the\n",
      " |              corresponding alpha value in ``ccp_alphas``.\n",
      " |  \n",
      " |  decision_path(self, X, check_input=True)\n",
      " |      Return the decision path in the tree.\n",
      " |      \n",
      " |      .. versionadded:: 0.18\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csr_matrix``.\n",
      " |      \n",
      " |      check_input : bool, default=True\n",
      " |          Allow to bypass several input checking.\n",
      " |          Don't use this parameter unless you know what you do.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      indicator : sparse matrix of shape (n_samples, n_nodes)\n",
      " |          Return a node indicator CSR matrix where non zero elements\n",
      " |          indicates that the samples goes through the nodes.\n",
      " |  \n",
      " |  get_depth(self)\n",
      " |      Return the depth of the decision tree.\n",
      " |      \n",
      " |      The depth of a tree is the maximum distance between the root\n",
      " |      and any leaf.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      self.tree_.max_depth : int\n",
      " |          The maximum depth of the tree.\n",
      " |  \n",
      " |  get_n_leaves(self)\n",
      " |      Return the number of leaves of the decision tree.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      self.tree_.n_leaves : int\n",
      " |          Number of leaves.\n",
      " |  \n",
      " |  predict(self, X, check_input=True)\n",
      " |      Predict class or regression value for X.\n",
      " |      \n",
      " |      For a classification model, the predicted class for each sample in X is\n",
      " |      returned. For a regression model, the predicted value based on X is\n",
      " |      returned.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      X : {array-like, sparse matrix} of shape (n_samples, n_features)\n",
      " |          The input samples. Internally, it will be converted to\n",
      " |          ``dtype=np.float32`` and if a sparse matrix is provided\n",
      " |          to a sparse ``csr_matrix``.\n",
      " |      \n",
      " |      check_input : bool, default=True\n",
      " |          Allow to bypass several input checking.\n",
      " |          Don't use this parameter unless you know what you do.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      y : array-like of shape (n_samples,) or (n_samples, n_outputs)\n",
      " |          The predicted classes, or the predict values.\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from BaseDecisionTree:\n",
      " |  \n",
      " |  feature_importances_\n",
      " |      Return the feature importances.\n",
      " |      \n",
      " |      The importance of a feature is computed as the (normalized) total\n",
      " |      reduction of the criterion brought by that feature.\n",
      " |      It is also known as the Gini importance.\n",
      " |      \n",
      " |      Warning: impurity-based feature importances can be misleading for\n",
      " |      high cardinality features (many unique values). See\n",
      " |      :func:`sklearn.inspection.permutation_importance` as an alternative.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      feature_importances_ : ndarray of shape (n_features,)\n",
      " |          Normalized total reduction of criteria by feature\n",
      " |          (Gini importance).\n",
      " |  \n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sklearn.base.BaseEstimator:\n",
      " |  \n",
      " |  __getstate__(self)\n",
      " |  \n",
      " |  __repr__(self, N_CHAR_MAX=700)\n",
      " |      Return repr(self).\n",
      " |  \n",
      " |  __setstate__(self, state)\n",
      " |  \n",
      " |  get_params(self, deep=True)\n",
      " |      Get parameters for this estimator.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      deep : bool, default=True\n",
      " |          If True, will return the parameters for this estimator and\n",
      " |          contained subobjects that are estimators.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      params : mapping of string to any\n",
      " |          Parameter names mapped to their values.\n",
      " |  \n",
      " |  set_params(self, **params)\n",
      " |      Set the parameters of this estimator.\n",
      " |      \n",
      " |      The method works on simple estimators as well as on nested objects\n",
      " |      (such as pipelines). The latter have parameters of the form\n",
      " |      ``<component>__<parameter>`` so that it's possible to update each\n",
      " |      component of a nested object.\n",
      " |      \n",
      " |      Parameters\n",
      " |      ----------\n",
      " |      **params : dict\n",
      " |          Estimator parameters.\n",
      " |      \n",
      " |      Returns\n",
      " |      -------\n",
      " |      self : object\n",
      " |          Estimator instance.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.model_selection import GridSearchCV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n",
      "/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py:552: FitFailedWarning: Estimator fit failed. The score on this train-test partition for these parameters will be set to nan. Details: \n",
      "Traceback (most recent call last):\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/model_selection/_validation.py\", line 531, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 894, in fit\n",
      "    X_idx_sorted=X_idx_sorted)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/tree/_classes.py\", line 200, in fit\n",
      "    self.class_weight, y_original)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/validation.py\", line 73, in inner_f\n",
      "    return f(**kwargs)\n",
      "  File \"/root/first_env/lib64/python3.6/site-packages/sklearn/utils/class_weight.py\", line 123, in compute_sample_weight\n",
      "    '\"balanced\". Given \"%s\".' % class_weight)\n",
      "ValueError: The only valid preset for class_weight is \"balanced\". Given \"weight\".\n",
      "\n",
      "  FitFailedWarning)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'class_weight': 'balanced',\n",
       " 'criterion': 'gini',\n",
       " 'min_samples_leaf': 5,\n",
       " 'min_samples_split': 2}"
      ]
     },
     "execution_count": 180,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "param_dict = {\n",
    "    'criterion':['gini', 'entropy'],\n",
    "    'min_samples_split':[2,3,4,5,6],\n",
    "    'min_samples_leaf':[1,2,3,4,5],\n",
    "    'class_weight':['balanced', 'weight'],\n",
    "}\n",
    "\n",
    "grid = GridSearchCV(tr, param_grid=param_dict, cv=2)\n",
    "\n",
    "grid.fit(x1,y1)\n",
    "grid.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 188,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.820627802690583"
      ]
     },
     "execution_count": 188,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tr = tree.DecisionTreeClassifier(\n",
    "#     class_weight='balanced',\n",
    "    criterion='gini',\n",
    "    min_samples_leaf=5,\n",
    "#     min_samples_split=2,\n",
    ")\n",
    "\n",
    "tr.fit(x1,y1)\n",
    "tr.score(x2,y2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
